local hx__shengzhi = fk.CreateSkill{
  name = "hx__shengzhi",
  tags = { Skill.Compulsory },
}


hx__shengzhi:addEffect(fk.AfterSkillEffect, {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(hx__shengzhi.name) and
      not data.skill:hasTag(Skill.Compulsory) and
      not (data.skill.cardSkill or data.skill.global) and data.skill:isPlayerSkill(target) and
      not data.skill.is_delay_effect
  end,
  on_use = function(self, event, target, player, data)
    player.room:setPlayerMark(player, "@@hx__shengzhi-turn", 1)
  end,
})

hx__shengzhi:addEffect(fk.PreCardUse, {
  is_delay_effect = true,
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(hx__shengzhi.name) then
      return player:getMark("@@hx__shengzhi-turn") > 0
    end
  end,
  on_use = function (self, event, target, player, data)
    data.additionalEffect = (data.additionalEffect or 0) + 1
    player.room:setPlayerMark(player, "@@hx__shengzhi-turn", 0)
  end,
})

hx__shengzhi:addEffect("targetmod", {
  bypass_times = function(self, player, skill, scope, card, to)
    return card and player:getMark("@@hx__shengzhi-turn") > 0
  end,
  bypass_distances =  function(self, player, skill, card, to)
    return card and player:getMark("@@hx__shengzhi-turn") > 0
  end,
})

return hx__shengzhi
